package com.hxht.storage.server.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hxht.storage.server.bean.ManualRecordBean;
import com.hxht.storage.server.bean.RecordStopBean;
import com.hxht.storage.server.service.ManualRecordService;

@Controller
@RequestMapping("/manual")///{deviceId}/{channelIndex}")
public class ManualRecordController {
	
	@Autowired
	private ManualRecordService recordService;
	
	@RequestMapping(value="/start")
	@ResponseBody
	public String startRecord(@RequestBody ManualRecordBean recordBean){
		String result = recordService.startRecord(recordBean);
		
//		System.out.println(JSONObject.toJSONString(recordBean));
		
		return result;
	}
	
	@RequestMapping(value="/stop")
	@ResponseBody
	public Boolean stopRecord(@RequestBody RecordStopBean stopBean){
		
		boolean result = recordService.stopRecord(stopBean);
		
//		System.out.println(JSONObject.toJSONString(stopBean));
		
		return result;
	}
	
	@RequestMapping(value="/recording", method = RequestMethod.DELETE)
	public void getCurrentRecording(){
		
	}

}
